# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=uvicorn
pkgver=0.25.0
pkgrel=0
pkgdesc="Lightning-fast ASGI server"
url="https://www.uvicorn.org/"
license="BSD-3-Clause"
arch="noarch"
depends="
	python3
	py3-asgiref
	py3-click
	py3-h11
	"
makedepends="py3-gpep517 py3-hatchling"
checkdepends="
	py3-a2wsgi
	py3-dotenv
	py3-httptools
	py3-httpx
	py3-pytest
	py3-pytest-mock
	py3-trustme
	py3-watchfiles
	py3-websockets
	py3-wsproto
	py3-yaml
	"
subpackages="$pkgname-pyc"
source="https://github.com/encode/uvicorn/archive/$pkgver/uvicorn-$pkgver.tar.gz"

case "$CARCH" in
	# test suite blocked by py3-httpx
	armhf|ppc64le) options="!check" ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/uvicorn-$pkgver-py3-none-any.whl
}

sha512sums="
19c1e6438c40ab1b1d30c9c9c84d65f2dc661197adcc6be3d7825223d933d4554ec388323e16452ef0409476766af1ae18bb3252a391099bd2e2bfe2b6c4abb2  uvicorn-0.25.0.tar.gz
"
